//
//  TransactionRecordsCell.m
//  WorkNest
//
//  Created by giantumbrella on 15/7/28.
//  Copyright (c) 2015年 nest. All rights reserved.
//

#import "TransactionRecordsCell.h"
#import "TransactionRecordsModel.h"
@interface TransactionRecordsCell ()
@property (nonatomic,strong) UIImageView *imageULR;
@property (nonatomic,strong) UILabel *labelOrderNum;
@property (nonatomic,strong) UILabel *labelDetail;

@end
@implementation TransactionRecordsCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        [self createSubviews];
    }
    return self;
}

- (void)createSubviews
{
    //产品图片
    self.imageULR = [[UIImageView alloc] initWithFrame:CGRectMake(20, 10, self.frame.size.width*0.25, 90)];
    [self addSubview:self.imageULR];
    self.imageULR.backgroundColor = [UIColor greenColor];
    
    //订单号
    self.labelOrderNum = [[UILabel alloc] initWithFrame:CGRectMake(self.imageULR.frame.size.width+self.imageULR.frame.origin.x+5, self.imageULR.frame.origin.y, self.frame.size.width*0.6, self.imageULR.frame.size.height*0.3)];
    [self addSubview:self.labelOrderNum];
    self.labelOrderNum.textColor = UIColorWithRGBA(130, 130, 130, 1);
    
    //详述
    self.labelDetail = [[UILabel alloc] initWithFrame:CGRectMake(self.labelOrderNum.frame.origin.x, self.labelOrderNum.frame.origin.y+self.labelOrderNum.frame.size.height+10, self.labelOrderNum.frame.size.width, self.imageULR.frame.size.height*0.6)];
    [self addSubview:self.labelDetail];
    self.labelDetail.textColor = UIColorWithRGBA(130, 130, 130, 1);
    
    //横线
    UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(0, 110, SCREEN_WIDTH, 1)];
    [self addSubview:lineView];
    lineView.backgroundColor = UIColorWithRGBA(227, 227, 227, 1);

}

- (void)layoutSubviews
{
    self.imageULR = nil;
    self.labelDetail.text = self.transRecordsModel.transrecTitle;
    self.labelDetail.numberOfLines = 4;
    [self.labelDetail sizeToFit];
    self.labelOrderNum.text = [NSString stringWithFormat:@"订单号：%@",self.transRecordsModel.transrecOrderNum];
}
@end
